thin.define(function(exports) {
	var self = this;

	// 检查
	function main(complete) {
		var url = thin.data['data-api'] + '/api?lottm.check&_t=' + Date.now();
		var data_opt = {
			no: thin.data['data-no']
		};
		var again = 10;
		request();
	
		function request() {
			thin.ajax.get(url, data_opt, function(res) {
				if (res.state) {
					if (res.data.data == 1) {
						complete(true);
					} else {
						// 检查失败
						console.log('%c>>> 未完成同步，继续下轮检查...','color:#E3B30E');
						if (again > 0) {
							setTimeout(request, 1.6 * 1000);
							--again;
						} else {
							complete();
						}
					}
				} else {
					// 检查失败
					if (again > 0) {
						setTimeout(request, 1.6 * 1000);
						--again;
					} else {
						complete();
					}
				}
			});
		}
	}

	exports('lottmCheck', main);
});